<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>
<body>
    <div id="root">
        <h2>欢迎来到{{name}}</h2>
        <button v-on:click='showInfo1'>点我提示信息(不传参)</button>
        <button @click='showInfo2($event, 66)'>点我提示信息(传参)</button>
    </div>

    <script>

        const vm = new Vue({
            el: '#root',
            data: {
                name: '尚硅谷'
            },
            methods: {
                showInfo1(e) {
                    console.log(this);
                    alert('同学你好呀!')
                },
                showInfo2(e, num) {
                    console.log(e.target.innerText, num);
                    alert('同学你好呀!!')
                }
            }
        })
    </script>
</body>
</html>